#!/bin/sh
#
# Start wifi_daemon....
#

start() {
    printf "Starting wifi_daemon....: \n"
	ifconfig wlan0 up
	mkdir -p /var/log/wpa_supplicant
	wpa_supplicant -B -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf #start wpa_supplicant
	#start-stop-daemon -S -q -m -b -p /var/run/sshd.pid -x /etc/init.d/ipservices #start ip servers
	#/etc/init.d/sshd start #start sshd
}

stop() {
	printf "Stopping wifi_daemon: \n"
	killall wpa_supplicant
	ifconfig wlan0 down
	#start-stop-daemon -K -q -p /var/run/sshd.pid -x /etc/init.d/ipservices
}

case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    restart|reload)
	stop
	start
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $?
